#include <stdio.h>
#include <stdlib.h>

int main(void) {
    // printf("Hello, World!\n");
    FILE *fp;
    char ch;
    if((fp=fopen("k/Users/axin/Downloads/C_Language_Program/code240902/test.txt","rt+"))==NULL) {
        printf("\nCannot open file strike any key exit!");
        getchar();
        exit(1);
    }
    ch=fgetc(fp);
    while (ch!=EOF) {
        putchar(ch);
        ch=fgetc(fp);
    }
    fclose(fp);
    return 0;
}
/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
 typedef struct ListNode ListNode;
struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2) {
    if(list1==NULL)
    {
        return list2;
    }
    if(list2==NULL){
        return list1;
    }
    ListNode *head=NULL;
    ListNode *tail=NULL;
    if(list1->val<list2->val){
        head=list1;
        tail=list1;
        list1=list1->next;
    }else{
        head=list2;
        tail=list2;
        list2=list2->next;
    }
    while(list1&&list2){
        if(list1->val<list2->val){
            tail->next=list1;
            list1=list1->next;
        }
        else
        {
            tail->next=list2;
            list2=list2->next;
        }
        tail=tail->next;
    }
    while(list1){
        tail->next=list1;
        list1=list1->next;
    }
    while(list2){
        tail->next=list2;
        list2=list2->next;
    }
    // tail->next=NULL;
    return head;
}